package com.example.backend.mapper;

import com.example.backend.entity.Score;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Repository
public interface ScoreMapper {

    @Insert("insert into score(dingdan_num,scorer_id,scorer_type,bescorer_id,bescorer_type,score) values(#{dingdan_num},#{scorer_id},#{scorer_type},#{bescorer_id},#{bescorer_type},#{score})")
    int addScore(Score score);

    @Update("update score set score=#{score} where dingdan_num=#{dingdan_num}")
    int updateScore(Score score);

    @Select("delete from score where dingdan_num= #{dingdan_num}")
    Integer deleteScore(String dingdan_num);

    @Select("select id,dingdan_num,scorer_id,scorer_type,bescorer_id,bescorer_type,score from score where dingdan_num= #{dingdan_num}")
    ArrayList<Score> selectScoreByNum(String dingdan_num);

    @Select("select  id,dingdan_num,scorer_id,scorer_type,bescorer_id,bescorer_type,score from score")
    ArrayList<Score> selectAll();
}
